package com.learn.eduuserboot.service.impl;

import com.learn.eduapi.entity.user.User;
import com.learn.eduuserboot.mapper.UserMapper;
import com.learn.eduuserboot.service.UserService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Override
    public List<User> getUserList(@Param("find")String find,@Param("page")Integer page, @Param("size")Integer size) {
        return userMapper.getAllUser(find,page,size);
    }

    @Override
    public User selectByPhone(String phone) {
        if (userMapper.selectByPhone(phone)!=null){
            return userMapper.selectByPhone(phone);
        }else {
            return null;
        }
    }

    @Override
    public int updateUser(User user) {
        return userMapper.updateUser(user);
    }

    @Override
    public User selectById(Long id) {
        return userMapper.selectById(id);
    }

    @Override
    public User selectByName(String name) {
        return userMapper.selectByName(name);
    }

    @Override
    public int insertUser(User user) {
        return userMapper.insertUser(user);
    }
}
